import request from '@/utils/request'

// 封装一个加载文章列表的接口
export const articleList = (params) => {

    return request({
        url: '/v1_0/articles',
        params
    })
}




// 封装一个获取新闻详情的方法
export const articleInfo = (id) => {

    return request({
        url: `/v1_0/articles/${id}`,
    })
}


// 封装一个点赞接口
export const zan = (data) => {

    return request({
        url: `/v1_0/article/likings`,
        method: 'post',
        data
    })
}
export const unzan = (id) => {

    return request({
        url: `/v1_0/article/likings/` + id,
        method: 'delete',
    })
}


export const unlike = (data) => {

    return request({
        url: `/v1_0/article/dislikes`,
        method: 'post',
        data
    })
}
export const cancelUnlike = (id) => {

    return request({
        url: `/v1_0/article/dislikes/` + id,
        method: 'delete',
    })
}